<template>
  <div class="page" ref="page">
    <div class="head">
      <h1>{{ type == 1 ? '公告' : '帮助' }}</h1>
    </div>
    <div class="panel" v-for="(item,index) in result" :key="index">
      <h2>{{ item.title }}</h2>
      <p v-html="item.content"></p>
    </div>
  </div>
</template>

<script>
  export default {
    data() {
      return {
        result: [],
        type: ''
      }
    },
    mounted() {
      this.$nextTick(function() {
        this.type = this.$route.query.type || '';
        this.initData();
      });
    },
    methods: {
      initData() {
        this.$http
          .get(`/game/help?type=${this.type}`)
          .then(res => {
            if (res.code == 200) {
              this.result = res.result;
            } else {}
          })
          .catch(function(error) {});
      }
    }
  }
</script>

<style lang="scss" scoped>
  
  .panel {
    h2 {
      color: $green;
      font-size: 14px;
    }
    p {
      font-size: 12px;
      color: #333;
      text-align: justify;
      word-break: break-all;
    }
  }
</style>